< previous page page_221 next page >

Page 221
When you click the Help button, it retrieves the last two parameters so that it knows which Help file to display and which Help context ID within that Help file to show. The Help context ID is a unique number that corresponds to a particular page in your help file for this application.
InputBox( ) Function
The InputBox() function creates a modal dialog box that can be used to retrieve one piece of information from a user. Instead of having to create your own custom dialog box to ask the user for a piece of information, you can utilize this built-in dialog box.
Examples Filename: InputBox.frm
InputBox() enables you to enter a caption, a title, and a default value for the input box, and it even allows you to position the input box to a certain location on the screen. In its simplest form, you can call the InputBox() function with just one parameter, as shown in the following code, to have an input box show up like the one in Figure 11.5.
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdSimple_Click()
   Dim strName As String

   strName = InputBox("Enter an Employee Name")
   MsgBox "You input " & strName
End Sub
In the cmdSimple_Click() event, you need to declare a variable, strName, to hold the value that will come back from the InputBox() function. This string is the value the user types into the text box in the input box. If the user presses the Cancel button, a blank string is returned.
8160-0221a.gif
Figure 11.5
A simple input box.

 
< previous page page_221 next page >

If you like this book, buy it!